#include "DxfLayer.h"
#include "DxfEntity.h"
#include <TGS/GeoMath2.0/Envelope.h>

DxfLayer::DxfLayer(void)
{
}


DxfLayer::~DxfLayer(void)
{
	for (size_t i = 0; i < _entities.size(); ++i)
	{
		delete _entities[i];
	}
	_entities.clear();
}

void DxfLayer::render( RenderContext* renderContext )
{
	for (size_t i = 0; i < _entities.size(); ++i)
	{
		_entities[i]->render(renderContext);
	}
}

DxfLayer::Envelope DxfLayer::getEnvelope() const
{
	Envelope envelope;
	for (size_t i = 0; i < _entities.size(); ++i)
	{
		Envelope temp = _entities[i]->getEnvelope();
		if(!temp.isEmpty())	envelope.expandToInclude(temp);
	}
	return envelope;
}
